// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/dashboard/workplace',
    children: [
      //例子
      /*{
        path: '/example',
        name: 'example',
        redirect: '/example/form',
        component: PageView,
        meta: { title: '例子', icon: bxAnaalyse, permission: ['system'] },
        children: [
          {
            path: '/example/form',
            name: 'form',
            component: () => import('@/pages/example/exapmle'),
            meta: { title: 'form', keepAlive: false, permission: ['system'] }
          }
        ]
      },*/
      //工作台
      {
        path: '/dashboard',
        name: 'dashboard',
        redirect: '/dashboard/workplace',
        component: RouteView,
        meta: { title: '首页', icon: bxAnaalyse },
        children: [
          {
            path: '/dashboard/workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace'),
            meta: { title: '工作台', keepAlive: true }
          }
        ]
      },
      //系统配置
      {
        path: '/system',
        name: 'system',
        redirect: '/system/menu',
        component: PageView,
        meta: { title: '系统管理', icon: 'setting', permission: ['system'] },
        children: [
          {
            path: '/system/menu',
            name: 'menu',
            component: () => import('@/pages/system/menu/menuList'),
            meta: { title: '菜单管理', permission: ['system'] }
          },
          {
            path: '/system/role',
            name: 'role',
            component: () => import('@/pages/system/role/roleList'),
            meta: { title: '角色管理', permission: ['system'] }
          },
        ]
      },
      //服务商
      {
        path: '/company',
        name: 'company',
        redirect: '/company/company',
        component: PageView,
        meta: { title: '服务商管理', icon: 'shop', permission: ['company'] },
        children: [
          {
            path: '/company/company',
            name: 'companyInfo',
            component: () => import('@/pages/system/company/companyInfo'),
            meta: { title: '服务商', permission: ['companyInfo'] }
          },
          {
            path: '/company/user',
            name: 'companyUser',
            component: () => import('@/pages/system/company/userList'),
            meta: { title: '服务商用户', permission: ['companyUser'] }
          }
        ]
      },
      //代理商
      /*{
        path: '/agent',
        name: 'agent',
        redirect: '/agent/agent',
        component: PageView,
        meta: { title: '代理商管理', icon: 'warning', permission: ['agent'] },
        children: [
          {
            path: '/agent/agent',
            name: 'agentInfo',
            component: () => import('@/pages/system/agent/agentList'),
            meta: { title: '代理商', permission: ['agentInfo'] }
          },
          {
            path: '/agent/user',
            name: 'agentUser',
            component: () => import('@/pages/system/agent/agentUserList'),
            meta: { title: '代理商用户', permission: ['agentUser'] }
          }
        ]
      },*/
      //客户(商圈)
      {
        path: '/customer',
        name: 'customer',
        redirect: '/customer/customer',
        component: PageView,
        meta: { title: '客户管理', icon: 'gitlab', permission: ['customer'] },
        children: [
          {
            path: '/customer/customer',
            name: 'customerInfo',
            component: () => import('@/pages/customer/customerInfo'),
            meta: { title: '客户(商圈)', permission: ['customerInfo'] }
          },
          {
            path: '/customer/user',
            name: 'customerUser',
            component: () => import('@/pages/customer/customerUserList'),
            meta: { title: '客户(商圈)用户', permission: ['customerUser'] }
          }
        ]
      },
      //商户管理
      {
        path: '/merchant',
        name: 'merchant',
        redirect: '/merchant/merchantInfo',
        component: PageView,
        meta: { title: '商户管理', icon: 'file-ppt', permission: ['merchant'] },
        children: [
          {
            path: '/merchant/merchantInfo',
            name: 'merchantInfo',
            component: () => import('@/pages/merchant/merchantList'),
            meta: { title: '我的商户', permission: ['merchant'] }
          },
          {
            path: '/merchant/user',
            name: 'merchantUser',
            component: () => import('@/pages/merchant/merchantUserList'),
            meta: { title: '商户用户', permission: ['merchantUser'] }
          },
        ]
      },
      //门店管理
      /*{
        path: '/store',
        name: 'store',
        redirect: '/store/storeInfo',
        component: PageView,
        meta: { title: '门店管理', icon: 'flag', permission: ['storeInfo'] },
        children: [
          {
            path: '/store/storeInfo',
            name: 'storeInfo',
            component: () => import('@/pages/store/storeList'),
            meta: { title: '我的门店', permission: ['storeInfo'] }
          },
          {
            path: '/store/user',
            name: 'storeUser',
            component: () => import('@/pages/store/storeUserList'),
            meta: { title: '门店用户', permission: ['storeUser'] }
          },
        ]
      },*/
      //优惠券
      {
        path: '/coupon',
        name: 'coupon',
        redirect: '/coupon/couponInfo',
        component: PageView,
        meta: { title: '优惠券管理', icon: 'dingding', permission: ['couponInfo'] },
        children: [
          {
            path: '/coupon/couponInfo',
            name: 'couponInfo',
            component: () => import('@/pages/coupon/couponInfo'),
            meta: { title: '代金券', permission: ['couponInfo'] }
          },
          {
            path: '/coupon/merCouponInfo',
            name: 'merCouponInfo',
            component: () => import('@/pages/coupon/merCouponInfo'),
            meta: { title: '商家券', permission: ['couponInfo'] }
          },
        ]
      },
      //交易记录
      {
        path: '/trade',
        name: 'trade',
        redirect: '/trade/tradeList',
        component: PageView,
        meta: { title: '交易管理', icon: 'property-safety', permission: ['tradeInfo'] },
        children: [
          {
            path: '/trade/tradeList',
            name: 'tradeInfo',
            component: () => import('@/pages/trade/tradeList'),
            meta: { title: '我的订单', permission: ['tradeInfo'] }
          }
        ]
      },
      //会员管理
      {
        path: '/member',
        name: 'member',
        redirect: '/member/memberInfo',
        component: PageView,
        meta: { title: '会员管理', icon: 'property-safety', permission: ['memberInfo'] },
        children: [
          {
            path: '/member/memberInfo',
            name: 'memberInfo',
            component: () => import('@/pages/member/memberInfo'),
            meta: { title: '会员列表', permission: ['memberInfo'] }
          }
        ]
      }

    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/test',
    component: BlankLayout,
    redirect: '/test/home',
    children: [
      {
        path: 'home',
        name: 'TestHome',
        component: () => import('@/views/Home')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
